/*
 *https://leetcode.cn/problems/longest-increasing-subsequence/description/
 *300. 最长递增子序列
 *medium, 叶佳豪 2024.9.20
 *动态规划
 */

class Solution {
public:
    int lengthOfLIS(vector<int>& nums) {
        int length = nums.size();
        vector<int> dp(length,1);
        for(int i=1;i<length;i++){
            for(int j=i;j>=0;j--){
                if(nums[i]>nums[j]){
                    dp[i]=max(dp[i],dp[j]+1);
                }
            }
        }
        return *max_element(dp.begin(),dp.end());
    }
};